import { LockUtils } from "@/utils/LockUtils";
import axios from "axios";
import {TokenUtils} from "@/utils/TokenUtils";

enum CodeType {
    T401 = 401,
    T402 = 402,
}


axios.interceptors.request.use(
    async (config) => {

        return config;
    },
    (error) => {
        return Promise.reject(error);
    }
);

axios.interceptors.response.use(
    (response: any) => {

        return response;
    },
    (err) => {
        let config = err.config;

        if (config.retry > 0) {
            config.retry--;
            config.data = JSON.parse(config.data);
            return axios(config);
        }
        return Promise.reject(err);
    }
);

